<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  
  
  <meta name="description" content="记录个人生活">
  
  <title>
    hexo_search部署到github上报找不到 “/js/search.js” |
    
    Gejin_Blog
  </title>
  
    <link rel="shortcut icon" href="/hexo-application/favicon.ico">
    
  
<link rel="stylesheet" href="/hexo-application/css/style.css">

  
  
<link rel="stylesheet" href="/hexo-application/fancybox/jquery.fancybox.min.css">

  
  
<script src="/hexo-application/js/pace.min.js"></script>

<meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/hexo-application/atom.xml" title="Gejin_Blog" type="application/atom+xml">
</head>

<body>
  <main class="content">
    <section class="outer">
  <article id="post-hexo_search_bug" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
      

<h1 class="article-title" itemprop="name">
  hexo_search部署到github上报找不到 “/js/search.js”
</h1>



    </header>
    

    
    <div class="article-meta">
      <a href="/hexo-application/2021/09/02/hexo_search_bug/" class="article-date">
  <time datetime="2021-09-02T09:30:05.783Z" itemprop="datePublished">2021-09-02</time>
</a>
      
    </div>
    

    
    
<div class="tocbot"></div>

    

    <div class="article-entry" itemprop="articleBody">
      
      
      
      <h1 id="部署到github上报找不到-“-js-search-js”解决办法"><a href="#部署到github上报找不到-“-js-search-js”解决办法" class="headerlink" title="部署到github上报找不到 “/js/search.js”解决办法"></a>部署到github上报找不到 “/js/search.js”解决办法</h1><pre><code><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">删除jquery-2.0.3.min.js中头部</span><br><span class="line">//@ sourceMappingURL=jquery.min.map</span><br><span class="line">更改ocean.js中的</span><br><span class="line"> // 建议在移动端不初始化，其实 /search.xml 文件还挺大的，大概在文件第60行</span><br><span class="line"> //hexo-application这个是你的github项目名称，统一替换掉</span><br><span class="line">  if ($(&#x27;.local-search&#x27;).size() &amp;&amp; !isMobile.any()) &#123;</span><br><span class="line">    $.getScript(&#x27;/hexo-application/js/search.js&#x27;, function () &#123;</span><br><span class="line">      searchFunc(&quot;/hexo-application/search.xml&quot;, &#x27;local-search-input&#x27;, &#x27;local-search-result&#x27;);</span><br><span class="line">    &#125;);</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>
</code></pre>
<h1 id="Ocean"><a href="#Ocean" class="headerlink" title="Ocean"></a>Ocean</h1><p>Ocean is a mobile-enabled Hexo theme based on the features in Hexo’s default theme landscape. Since I am a Designer and not a Coder, so please advise! I am very grateful to <a target="_blank" rel="noopener" href="https://github.com/youchen1992">youchen1992</a> for providing technical support during the Ocean production process.</p>
<p><a target="_blank" rel="noopener" href="https://zhwangart.github.io/">Preview</a></p>
<p><a target="_blank" rel="noopener" href="https://zhwangart.github.io/2018/11/30/Ocean/">中文说明</a></p>
<p><img src="/hexo-application/screenshots/hexo-theme-ocean.jpg" alt="Screenshot"></p>
<h2 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> https://github.com/zhwangart/hexo-theme-ocean.git themes/ocean</span><br></pre></td></tr></table></figure>

<h2 id="Enable"><a href="#Enable" class="headerlink" title="Enable"></a>Enable</h2><p>Modify <code>theme</code> setting in <code>_config.yml</code> to <code>ocean</code></p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">theme:</span> <span class="string">ocean</span></span><br></pre></td></tr></table></figure>

<h2 id="Update"><a href="#Update" class="headerlink" title="Update"></a>Update</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> themes/ocean</span><br><span class="line">git pull</span><br></pre></td></tr></table></figure>

<h2 id="Configuration"><a href="#Configuration" class="headerlink" title="Configuration"></a>Configuration</h2><p>let me know if you can’t find something.</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Menu</span></span><br><span class="line"><span class="attr">menu:</span></span><br><span class="line">  <span class="attr">Home:</span> <span class="string">/</span></span><br><span class="line">  <span class="attr">Archives:</span> <span class="string">/archives</span></span><br><span class="line">  <span class="attr">Gallery:</span> <span class="string">/gallery</span></span><br><span class="line">  <span class="attr">About:</span> <span class="string">/about</span></span><br><span class="line">  <span class="attr">Links:</span> <span class="string">/links</span></span><br><span class="line"><span class="attr">rss:</span> <span class="string">/atom.xml</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Miscellaneous</span></span><br><span class="line"><span class="attr">favicon:</span> <span class="string">/favicon.ico</span></span><br><span class="line"><span class="attr">brand:</span> <span class="string">/images/hexo.svg</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Ocean Video</span></span><br><span class="line"><span class="comment"># Because I put videos in multiple formats on the same path, I just labeled the path here.</span></span><br><span class="line"><span class="attr">ocean:</span></span><br><span class="line">  <span class="attr">overlay:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">path:</span> <span class="string">images/ocean/</span>      <span class="comment"># Video storage path, formats: mp4/ogg/webm</span></span><br><span class="line">  <span class="attr">brand:</span> <span class="string">/images/hexo-inverted.svg</span>      <span class="comment"># Optional, a small logo</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Content</span></span><br><span class="line"><span class="attr">excerpt_link:</span> <span class="string">Read</span> <span class="string">More...</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># fancybox</span></span><br><span class="line"><span class="attr">fancybox:</span> <span class="literal">true</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Local search</span></span><br><span class="line"><span class="attr">search_text:</span> <span class="string">Search</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Gitalk</span></span><br><span class="line"><span class="attr">gitalk:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">clientID:</span> <span class="comment"># GitHub Application Client ID</span></span><br><span class="line">  <span class="attr">clientSecret:</span> <span class="comment"># Client Secret</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="comment"># Repository name</span></span><br><span class="line">  <span class="attr">owner:</span> <span class="comment"># GitHub ID</span></span><br><span class="line">  <span class="attr">admin:</span> <span class="comment"># GitHub ID</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Valine</span></span><br><span class="line"><span class="attr">valine:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">false</span>    <span class="comment"># Default: false.</span></span><br><span class="line">  <span class="attr">el:</span> <span class="string">&#x27;vcomments&#x27;</span>    <span class="comment"># The DOM element to be mounted on initialization.</span></span><br><span class="line">  <span class="attr">appId:</span>    <span class="comment"># Application appId from Leancloud.</span></span><br><span class="line">  <span class="attr">appKey:</span>    <span class="comment"># Application appKey from Leancloud.</span></span><br><span class="line">  <span class="attr">notify:</span> <span class="literal">false</span>    <span class="comment"># Mail notifier, Default: false.</span></span><br><span class="line">  <span class="attr">verify:</span> <span class="literal">true</span>    <span class="comment"># Validation code, Default: true.</span></span><br><span class="line">  <span class="attr">avatar:</span> <span class="string">&#x27;mp&#x27;</span>    <span class="comment"># Gravatar type.</span></span><br><span class="line">  <span class="attr">pageSize:</span> <span class="string">&#x27;10&#x27;</span>    <span class="comment"># Number of pages per page.</span></span><br><span class="line">  <span class="attr">placeholder:</span> <span class="string">&#x27;请输入...&#x27;</span>    <span class="comment"># Comment box placeholders.</span></span><br></pre></td></tr></table></figure>

<p>The <a target="_blank" rel="noopener" href="https://feathericon.com/">feathericon</a> in the menu is programmed ordely in “CSS <code>source/css/_partial/navbar.styl</code> “ and can be changed or added if needed.</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.nav-item</span></span><br><span class="line">  &amp;<span class="selector-pseudo">:nth-child</span>(<span class="number">1</span>)         // home</span><br><span class="line">    <span class="selector-class">.nav-item-link</span></span><br><span class="line">      &amp;<span class="selector-pseudo">::before</span></span><br><span class="line">        <span class="attribute">content</span> &#x27;\f12f&#x27;</span><br><span class="line">  &amp;<span class="selector-pseudo">:nth-child</span>(<span class="number">2</span>)         // archives</span><br><span class="line">    <span class="selector-class">.nav-item-link</span></span><br><span class="line">      &amp;<span class="selector-pseudo">::before</span></span><br><span class="line">        <span class="attribute">content</span> &#x27;\f12a&#x27;</span><br><span class="line">  //&amp;<span class="selector-pseudo">:nth-child</span>(<span class="number">3</span>)         // gallery</span><br><span class="line">  //  <span class="selector-class">.nav-item-link</span></span><br><span class="line">  //    &amp;<span class="selector-pseudo">::before</span></span><br><span class="line">  //      <span class="attribute">content</span> &#x27;\f1a9&#x27;</span><br><span class="line">  //&amp;<span class="selector-pseudo">:nth-child</span>(<span class="number">4</span>)         // about</span><br><span class="line">  //  <span class="selector-class">.nav-item-link</span></span><br><span class="line">  //    &amp;<span class="selector-pseudo">::before</span></span><br><span class="line">  //      <span class="attribute">content</span> &#x27;\f174&#x27;</span><br></pre></td></tr></table></figure>

<h2 id="Plugins"><a href="#Plugins" class="headerlink" title="Plugins"></a>Plugins</h2><ul>
<li><p><a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-theme-landscape">hexo-generator-search</a> Local search</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">$</span> <span class="string">npm</span> <span class="string">install</span> <span class="string">hexo-generator-searchdb</span> <span class="string">--save</span></span><br></pre></td></tr></table></figure>
<p>Then add the plugin configuration for hexo’s configuration file <code>_config.yml</code> (note: not the theme’s configuration file):</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Hexo-generator-search</span></span><br><span class="line"><span class="attr">search:</span></span><br><span class="line">  <span class="attr">path:</span> <span class="string">search.xml</span></span><br><span class="line">  <span class="attr">field:</span> <span class="string">post</span></span><br><span class="line">  <span class="attr">format:</span> <span class="string">html</span></span><br></pre></td></tr></table></figure></li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-generator-feed">hexo-generate-feed</a> RSS</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">$</span> <span class="string">npm</span> <span class="string">install</span> <span class="string">hexo-generator-feed</span> <span class="string">--save</span></span><br></pre></td></tr></table></figure>

<p>Then add the plugin configuration for hexo’s configuration file <code>_config.yml</code> (note: not the theme’s configuration file):</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">feed:</span></span><br><span class="line">    <span class="attr">type:</span> <span class="string">atom</span></span><br><span class="line">    <span class="attr">path:</span> <span class="string">atom.xml</span></span><br><span class="line">    <span class="attr">limit:</span> <span class="number">20</span></span><br><span class="line">    <span class="attr">hub:</span></span><br><span class="line">    <span class="attr">content:</span></span><br><span class="line">    <span class="attr">content_limit:</span> <span class="number">140</span></span><br><span class="line">    <span class="attr">content_limit_delim:</span> <span class="string">&#x27; &#x27;</span></span><br><span class="line">    <span class="attr">order_by:</span> <span class="string">-date</span>	</span><br></pre></td></tr></table></figure></li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/netcan/hexo-generator-index-pin-top">hexo-generator-index-pin-top</a></p>
  <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ npm uninstall hexo-generator-index --save</span><br><span class="line">$ npm install hexo-generator-index-pin-top --save</span><br></pre></td></tr></table></figure></li>
</ul>
<h2 id="Post-poster"><a href="#Post-poster" class="headerlink" title="Post poster"></a>Post poster</h2><figure class="highlight md"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: Post name</span><br><span class="line"></span><br><span class="line">photos: [</span><br><span class="line"><span class="code">        [&quot;img_url&quot;],</span></span><br><span class="line"><span class="code">        [&quot;img_url&quot;]</span></span><br><span class="line"><span class="code">        ]</span></span><br><span class="line"><span class="code">---</span></span><br></pre></td></tr></table></figure>

<h2 id="Gallery"><a href="#Gallery" class="headerlink" title="Gallery"></a>Gallery</h2><p>Need to write in the head of the markdown, this is not a good way to write, I hope to get a better way to write on github.</p>
<figure class="highlight md"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: Gallery</span><br><span class="line"></span><br><span class="line">albums: [</span><br><span class="line"><span class="code">        [&quot;img_url&quot;,&quot;img_caption&quot;],</span></span><br><span class="line"><span class="code">        [&quot;img_url&quot;,&quot;img_caption&quot;]</span></span><br><span class="line"><span class="code">        ]</span></span><br><span class="line"><span class="code">---</span></span><br></pre></td></tr></table></figure>

<h2 id="Toc"><a href="#Toc" class="headerlink" title="Toc"></a>Toc</h2><p>Use Tocbot to parse the title tags (h1~h6) in the content and insert the directory. </p>
<ul>
<li><p>ocean/_config.yml</p>
  <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Toc</span></span><br><span class="line"> toc: <span class="literal">true</span></span><br></pre></td></tr></table></figure></li>
<li><p>If Toc is turned on in ocean/_config.yml, then Tocbot will generate a Toc article directory in the title tag of each blog parsing content, but not all blogs require Toc, so in the Front-matter section of markdown Can be closed:</p>
  <figure class="highlight md"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line"> toc: false</span><br><span class="line"> ---</span><br></pre></td></tr></table></figure></li>
</ul>
<hr>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://enticejin.github.io/2021/09/02/hexo_search_bug/" data-id="ckt2qs92d0006rk6wg9fk1uet" class="article-share-link">
        分享
      </a>
      
    </footer>

  </div>

  
  
<nav class="article-nav">
  
  
  <a href="/hexo-application/2021/09/02/hexo-Search/" class="article-nav-link">
    <strong class="article-nav-caption">后一篇</strong>
    <div class="article-nav-title">hexo Search 官方文档</div>
  </a>
  
</nav>

  

  
  
  
  

</article>
</section>
    <footer class="footer">
  <div class="outer">
    <div class="float-right">
      <ul class="list-inline">
  
  <li><i class="fe fe-smile-alt"></i> <span id="busuanzi_value_site_uv"></span></li>
  
  <li><i class="fe fe-bookmark"></i> <span id="busuanzi_value_page_pv"></span></li>
  
</ul>
    </div>
    <ul class="list-inline">
      <li>Gejin_Blog &copy; 2021</li>
      
        <li>黔ICP备17054916号-2</li>
      
      <li>Powered by <a href="http://hexo.io/" target="_blank">Hexo</a></li>
      <li>theme  <a target="_blank" rel="noopener" href="https://github.com/zhwangart/hexo-theme-ocean">Ocean</a></li>
    </ul>
  </div>
</footer>
  </main>
  <aside class="sidebar">
    <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/hexo-application/"><img src="/hexo-application/favicon.ico" alt="Gejin_Blog"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo-application/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo-application/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo-application/gallery">相册</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/hexo-application/about">关于</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link nav-item-search" title="搜索">
        <i class="fe fe-search"></i>
        搜索
      </a>
    </li>
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      <div class="totop" id="totop">
  <i class="fe fe-rocket"></i>
</div>
    </li>
    <li class="nav-item">
      
      <a class="nav-item-link" target="_blank" href="/hexo-application/atom.xml" title="RSS Feed">
        <i class="fe fe-feed"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
  </aside>
  
<script src="/hexo-application/js/jquery-2.0.3.min.js"></script>


<script src="/hexo-application/js/jquery.justifiedGallery.min.js"></script>


<script src="/hexo-application/js/lazyload.min.js"></script>


<script src="/hexo-application/js/busuanzi-2.3.pure.min.js"></script>



<script src="/hexo-application/fancybox/jquery.fancybox.min.js"></script>




<script src="/hexo-application/js/copybtn.js"></script>




<script src="/hexo-application/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
  });
</script>


<script src="/hexo-application/js/ocean.js"></script>


  
<script src="/hexo-application/js/search.js"></script>


</body>

</html>